<template>
  <div v-if="details.length">
    <img
      :src="isHttp(details[0].imgUrl)"
      alt=""
      class="w-100"
      style="height: 450px"
    />
    <div id="crumbs" class="max-1200">
      <img src="@/assets/icon/weizhi.png" alt="" class="ic" />

      <a href="/">{{
        globalLanguage.languageSuffix == "Cn" ? "首页" : "Главная страница"
      }}</a>
      &gt;

      <a>{{
        globalLanguage.languageSuffix === "Cn" ? "公司业务" : "Операции"
      }}</a>
      &gt;
      <a>{{
        globalLanguage.languageSuffix === "Cn"
          ? "双清含税专线"
          : "Двойная налоговая линия"
      }}</a>
      &gt;
      <router-link to="/business/shuangqing/air"> {{
          globalLanguage.languageSuffix === "Cn"
            ? "双清空运"
            : "Двойной воздушный транспорт"
        }}</router-link>

    </div>

    <h2 class="title1">
<!--      {{ details[0]["title" + globalLanguage.languageSuffix] }}-->
      <el-input v-model="details[0]['title' + globalLanguage.languageSuffix]" size="large" style="width: 200px"></el-input>
    </h2>
    <p><br /></p>
    <div style="margin-bottom: 50px;text-align: center;">
      <div v-for="(item, index) in details" :key="index">
<!--        <div class="max-1200" style="line-height: 100px">-->
<!--          <p v-html="item['desc' + globalLanguage.languageSuffix]"></p>-->
<!--        </div>-->
        <el-input v-model="item['desc' + globalLanguage.languageSuffix]" type="textarea" size="large"  :rows="10"></el-input>
      </div>
      <!--        修改完所有输入框点击此按钮进行修改-->
      <el-button type="success" @click="changeAllText" style="margin: 10px 0;" >更改后点击此按钮进行修改</el-button>
    </div>
  </div>
</template>

<script setup>
import { detailsText , updateAlltext } from "@/api/alltext.js";
import { ref } from "vue";
import {ElMessage} from "element-plus";

const details = ref([]);
const getText = async () => {
  try {
    const response = await detailsText(2);
    details.value = response.list;
  } catch (error) {
    console.error("获取数据失败:", error);
  }
};
getText();
const changeAllText = async () => {
  try {
    const response = await updateAlltext(details.value);
   if (response.code === 200) {
     ElMessage({
       message: '信息更新成功',
       grouping: true,
       type: 'success',
     })
   }
  } catch (error) {
    console.error("修改失败:", error);
  }
};
</script>

<style></style>
